package com.jblv.frame.common.message;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;

/**
 * <p>封装返回实体</p>
 *
 * @author jblv
 * @version 1.0
 * @date 2019/6/15 0015
 * @since jdk1.8
 */
@ApiModel(value="基础REST返回类",description="基础REST返回类")
public class Result<T> implements Serializable {

    private static final long serialVersionUID = -2215304260629038881L;

    @ApiModelProperty(example="1")
    private int code;
    @ApiModelProperty(example="1")
    private int status;
    @ApiModelProperty(example="操作成功")
    private String message;
    private T data;

    public int getCode() {
        return code;
    }

    public int isStatus() {
        return status;
    }

    public String getMessage() {
        return message;
    }

    public T getData() {
        return data;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public void setData(T data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "{\"code\":\"" + code + "\"," +
                " \"status\":\"" + status + "\", " +
                "\"msg\":\"" + message + "\"," +
                " \"data\":\"" + data + "\"}";
    }
}
